<?php
namespace Association\Controller;
use Think\Controller;
class UserController extends CommonController {
    public function index(){
		$User = M('user');
		$count = $User -> count();// 查询满足要求的总记录数
		$P = new \Think\Page($count,20);// 实例化分页类 传入总记录数和每页显示的记录数(25)
		
		$tpl = '<ul data-am-widget="pagination" class="am-pagination am-pagination-default am-fr">';
		$tpl .= '<li class="am-pagination-first ">%FIRST%</li>';
		$tpl .= '<li class="am-pagination-prev ">%UP_PAGE%</li>';
		$tpl .= '<li class="">%LINK_PAGE%</li>';
		$tpl .= '<li class="am-pagination-next ">%DOWN_PAGE%</li>';
		$tpl .= '<li class="am-pagination-last ">%END%</li>';
		$tpl .= '</ul>';
		$P->setConfig('header','条记录');
		$P->setConfig('first','首页');
		$P->setConfig('prev','上一页');
		$P->setConfig('next','下一页');
		$P->setConfig('last','末页');
		$P->setConfig('theme',$tpl);
		
		$show = $P->show();// 分页显示输出
		$list = $User -> order('uid')->limit($P->firstRow.','.$P->listRows)->select();
		
		$this->assign('list',$list);// 赋值数据集
		$this->assign('page',$show);// 赋值分页输出
		$this -> assign('count',$count);
		
		$this -> display('./user-list');
	}
}